/*
 * Copyright (C) 2010, JDevelopers (jdevelopers@my-pages.org) 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0 
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */
/**
 * 
 */
package org.jdevelopers.xarf;

import java.util.EnumSet;

/**
 * Enumeration for identifying a report type.
 * 
 * @author Marcel
 * @version 0.2
 * @since JXarfValidator 0.2
 */
public enum EReportType {
	
	/**
	 * Identifies a report as an ARF report.
	 */
	ARF_REPORT("arf-report"),
	
	/**
	 * Identifies a report as a X-ARF report.
	 */
	XARF_REPORT("xarf-report"),
	
	/**
	 * Identifies an hotmail abuse-message.
	 */
	HOTMAIL_RFC822("hotmail-rfc822");
	
	private final String type;
		
	/**
	 * Constructor for creating an instance of a EReportType.
	 * @param type
	 */
	EReportType(String type) {
		this.type = type;
	}
	
	/**
	 * Returns the name for the EReportType.
	 * 
	 * @return Name for the EReportType.
	 */
	public String getType() {
		return type;
	}
	
	
	/**
	 * Provides the String representation of the <code>EReportType</code>.
	 */
	@Override
	public String toString() {
		return type;
	}
	
	/**
	 * Returns the associated EReportType from the given name.
	 * 
	 * @param enumName the name for EXarfReportAttachmentType you want to get.
	 * @return the associated EXarfPropertyFormatType.
	 */
	public static EReportType getByValue(String enumName) {
		for (final EReportType element : EnumSet.allOf(EReportType.class)) {
            if (element.toString().equals(enumName)) {
                return element;
            }
        }
        return null;
	}
}
